﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;

namespace zielonka.co.uk.extensions.system.data
{
    // Description: Used with IDataReader to return a DataTable from the reader.
    /*
        // Set up your connection and command objects first
        var reader = command.ExecuteReader();
        var table = reader.ToDataTable();
    */


    // A set of extension methods for IDataReader
    public static partial class DataReaderExtensions
    {
        /// <summary>
        /// Toes the data table.
        /// </summary>
        /// <param name="dr">The dr.</param>
        /// <returns></returns>
        public static DataTable ToDataTable(this IDataReader dataReader)
        {
            DataTable result = new DataTable();
            result.Load(dataReader);
            return result;
        }
    }
}
